
const { sequelize, DataTypes } = require('../../utill/getSequelize')

//课程描述表
const Class_description = sequelize.define('Class_description', {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true,
  },

  code: {//课程编码
    type: DataTypes.STRING,
  },

  quality: {//课程性质
    type: DataTypes.STRING,
    // allowNull: false,
  },

  cName: {//课程名称
    type: DataTypes.STRING,
    // allowNull: false,
  },

  eName: {//英文名称
    type: DataTypes.STRING,
    // allowNull: false,
  },

  creAndHours: {//学分/学时
    type: DataTypes.STRING,
    // allowNull: false,
  },

  praHours: {//实践学时
    type: DataTypes.STRING,
    // allowNull: false,
  },

  class_unit: {//开课单位
    type: DataTypes.STRING,
    // allowNull: false,
  },

  teacher_grade: {//所教学年
    type: DataTypes.STRING,
    // allowNull: false,
  },

  teacher_unit: {//所教学院
    type: DataTypes.STRING,
    // allowNull: false,
  },

  classname: {//所教班级
    type: DataTypes.STRING,
    // allowNull: false,
  },

  majors: {//适用专业
    type: DataTypes.STRING,
    // allowNull: false,
  },

  per_class: {//先修课程
    type: DataTypes.STRING,
    // allowNull: false,
  },

  class_com: {//课程网站
    type: DataTypes.STRING,
    // allowNull: false,
  },

  language: {//授课语言
    type: DataTypes.STRING,
    // allowNull: false,
  },

  t_user_and_a_c_s_id: {
    type: DataTypes.INTEGER,
    allowNull: false,
  },

});


//同步模型和数据库表
(async () => {
  try {
    await sequelize.sync({ force: false });
    console.log('All models were synchronized successfully.');
  } catch (error) {
    console.log(error);
  }

})();

//提供出去
module.exports = { Class_description };